#include "head.h"

int a[10] ={0};
int *sortGrade()
{
    int temp;
    srand(time(NULL));
    for (size_t i = 0; i < sizeof(a) / sizeof(int); i++)
    {
        a[i] = rand() % 100 + 1;
    }
    for (size_t i = 0; i < sizeof(a) / sizeof(int); i++)
    {
        for (size_t j = 0; j < sizeof(a) / sizeof(int)- i-1; j++)
        {
            if (a[j] > a[j + 1])
            {
                temp = a[j + 1];
                a[j + 1] = a[j];
                a[j] = temp;
            }
        }
    }
    puts("排序后学生成绩为");
      for (size_t k = 0; k < sizeof(a) / sizeof(int); k++)
    {
       printf("arr[%ld]=%d\n",k,a[k]);
    }
    return a;
}

void getgrade(int *a)
{
    char b[10];
    for (size_t i = 0; i < 10; i++)
    {
        if (a[i] >= 90)
            b[i] = 'A';
        else if (a[i] >= 80)
            b[i] = 'B';
        else if (a[i] >= 70)
            b[i] = 'C';
        else if (a[i] >= 60)
            b[i] = 'D';
        else
            b[i] = 'F';
    }
    puts("学生等级排名");
    for (size_t i = 0; i < 10; i++)
    {
        printf("%c\n", b[i]);
    }
}
